package com.zeei.lcp.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zeei.common.controller.BasicController;
import com.zeei.common.vo.ResultRowsVO;
import com.zeei.lcp.service.QRcodeLcpService;
import com.zeei.lcp.vo.TreeNodeLcpVO;

/**
 * @类型名称：QRcodeLcpController
 * @类型描述：二维码管理Controller
 * @功能描述：生命周期---二维码管理
 * @创建作者：meng.jy
 * @创建时间: 2018年1月21日
 */
@Controller("QRcodeLcpController")
@RequestMapping("/lcp/qrcode")
public class QRcodeLcpController extends BasicController {

	@Autowired
	@Qualifier("QRcodeLcpServiceImpl")
	private QRcodeLcpService qrcodeLcpService;

	/**
	 * queryAreaCode: 获取左边树 ResultRowsVO<TreeNodeLcpVO>
	 */
	@RequestMapping(value = "/treeList", method = RequestMethod.POST)
	@ResponseBody
	public ResultRowsVO<TreeNodeLcpVO> queryTreeList(TreeNodeLcpVO vo) {
		if (vo != null && (vo.getLevel() == null || vo.getLevel() <= 0)) {
			vo.setLevel(1);
		}
		List<TreeNodeLcpVO> retList = this.qrcodeLcpService.queryTreeList(vo);
		return this.createResultRowsVO(retList, true, null, retList.size());

	}

	/**
	 * queryDischargePoint:获取排口列表 ResultRowsVO<TreeNodeLcpVO>
	 */
	@RequestMapping(value = "/dischargePoints", method = RequestMethod.POST)
	@ResponseBody
	public ResultRowsVO<TreeNodeLcpVO> queryDischargePoints(TreeNodeLcpVO vo) {
		List<TreeNodeLcpVO> retList = this.qrcodeLcpService.queryDischargePoints(vo);
		return this.createResultRowsVO(retList, true, null, retList.size());
	}

}
